{% extends 'base.html' %}

{% block title %}更新订单状态 - 花店订单系统{% endblock %}

{% block content %}
<div class="container">
    <div class="row">
        <div class="col-md-8 offset-md-2">
            <div class="card">
                <div class="card-header">
                    <h3 class="card-title">更新订单状态</h3>
                </div>
                <div class="card-body">
                    <div class="mb-4">
                        <h4>订单信息</h4>
                        <p><strong>订单号：</strong>{{ order.id }}</p>
                        <p><strong>商品：</strong>{{ order.product.name }}</p>
                        <p><strong>数量：</strong>{{ order.quantity }}</p>
                        <p><strong>总价：</strong>¥{{ order.total_price }}</p>
                        <p><strong>当前状态：</strong>{{ order.get_status_display }}</p>
                        <p><strong>收货地址：</strong>{{ order.address }}</p>
                        <p><strong>联系电话：</strong>{{ order.phone }}</p>
                        <p><strong>创建时间：</strong>{{ order.created_at|date:"Y-m-d H:i" }}</p>
                    </div>

                    <form method="post">
                        {% csrf_token %}
                        <div class="mb-3">
                            <label for="status" class="form-label">更新状态</label>
                            <select class="form-select" id="status" name="status">
                                {% for status_code, status_name in order.STATUS_CHOICES %}
                                    <option value="{{ status_code }}" 
                                            {% if order.status == status_code %}selected{% endif %}>
                                        {{ status_name }}
                                    </option>
                                {% endfor %}
                            </select>
                        </div>
                        <div class="d-grid gap-2">
                            <button type="submit" class="btn btn-primary">更新状态</button>
                            <a href="{% url 'orders:order_list' %}" class="btn btn-secondary">返回订单列表</a>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %} 